NotificationListPortlet = Class.extend({
	init: function()	{
		this.name = "NotificationListPortlet";
	},
	
	onBegin: function()	{
		this.registerObserver();
	},
	
	onEnd: function()	{
		this.unregisterObserver();
	},
	
	onReloadPage: function()	{
		this.run();
	},
	
	run: function()	{
		//store the current object
		var obj = this;
		this.onAjax('user', 'get-new-notifications', {}, 'GET', {
			'onSuccess': function(ret)	{
				obj.model = {};
				obj.model.result = ret;
				obj.getPortletPlaceholder().paintCanvas(obj.render());
				obj.onAjax('user', 'get-old-notifications', {}, 'GET', {
					'onSuccess': function(ret)	{
						obj.requestForEffectiveResource('Old').html(obj.renderView('OldNotification', {result: ret}));
					}
				});
			}
		});
	}
}).implement(PortletInterface).implement(RenderInterface).implement(AjaxInterface).implement(ObserverInterface);